package com.lznAdmin.system.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lznAdmin.base.common.vo.DictVO;
import com.lznAdmin.system.entity.SysDictMain;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.LinkedHashMap;
import java.util.List;

@Mapper
public interface SysDictMainMapper extends BaseMapper<SysDictMain> {

    @Select("SELECT " +
            "b.dict_text as dictText," +
            "b.dict_value as dictValue " +
            "FROM `sys_dict_main` a " +
            "INNER JOIN `sys_dict_sub` b ON a.id = b.main_id " +
            "where a.dict_code = #{code}")
    List<DictVO> selecetMainAndSubList(String code);

    @Select("select ${sqlStr}")
    List<LinkedHashMap<String, Object>> selectTableDictList(@Param(value = "sqlStr") String sqlStr);
}
